{
 "cells": [
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": [
    "#programming_fever\n",
    "#play video in reverse mode using OpenCV python\n",
    "import cv2   \n",
    "cap = cv2.VideoCapture(\"E://OpenCV//video 2 img//BMW M4.mp4\") \n",
    "check , vid = cap.read()\n",
    "counter = 0\n",
    "check = True \n",
    "frame_list = [] \n",
    "while(check == True): \n",
    "    cv2.imwrite(\"frame%d.jpg\" %counter , vid) \n",
    "    check , vid = cap.read() \n",
    "    frame_list.append(vid) \n",
    "    counter += 1\n",
    "frame_list.pop() \n",
    "frame_list.reverse() \n",
    "for frame in frame_list: \n",
    "    cv2.imshow(\"Frame\" , frame) \n",
    "    if cv2.waitKey(25) and 0xFF == ord(\"q\"): \n",
    "        break\n",
    "cap.release() \n",
    "cv2.destroyAllWindows()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.7.4"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
